﻿using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Text;
using DLV.Utilities;

namespace DLV.Data.Entities
{
    public class MenuTypeController
    {
        public int InsertMenuType(MenuTypeInfo info)
        {
            return SQL.InsertMenuType(info.MenuTypeName, info.CreatedBy, info.CreatedDate, info.UpdatedBy, info.UpdatedDate, info.Status);
        }
        public void UpdateMenuType(MenuTypeInfo info)
        {
            SQL.UpdateMenuType(info.MenuTypeId, info.MenuTypeName, info.CreatedBy, info.CreatedDate, info.UpdatedBy, info.UpdatedDate, info.Status);
        }
        public void DeleteMenuType(MenuTypeInfo info)
        {
            DeleteMenuType(info.MenuTypeId);
        }
        public void DeleteMenuType(int menuTypeId)
        {
            SQL.DeleteMenuType(menuTypeId);
        }
        public MenuTypeInfo GetMenuType(int menuTypeId)
        {
            return CBO.FillObject<MenuTypeInfo>(SQL.GetMenuType(menuTypeId));
        }
        public List<MenuTypeInfo> ListMenuType()
        {
            return CBO.FillCollection<MenuTypeInfo>(SQL.ListMenuType());
        }
        public DataTable SelectMenuType()
        {
            return CBO.ConvertToDataTable(ListMenuType(), typeof(MenuTypeInfo));
        }
        public Dictionary<object, object> ListMenuTypeLookup()
        {
            var menuTypes = ListMenuType();
            return menuTypes.ToDictionary<MenuTypeInfo, object, object>(info => info.MenuTypeId, info => info.MenuTypeName);
        }
    }
}
